package com.sxz.sbs.module.sms.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.module.sms.mode.SmsCustomBean;
import com.sxz.sbs.module.sms.view.ChoseSmsClientView;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;
import java.util.List;

/**
 * 选择短信用户P
 */

public class ChoseSmsClientPresenter extends RxPresenter<ChoseSmsClientView>{
    /**
     * 获取短信客户列表
     * @param map
     */
    public void getSmsCustomList (HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getSmsCustomList(map)
                .compose(RxUtil.<List<SmsCustomBean>>handleResult())
                .subscribeWith(new RxSubscriber<List<SmsCustomBean>>(mView,true){
                    @Override
                    public void onNext(List<SmsCustomBean> data) {
                        mView.onGetSmsClientListSuccess(data);
                    }
                })
        );
    }
}
